﻿using System;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using SuperSocket;
using SuperSocket.Command;

namespace Demo005
{
    
     
   
    
      
    /// <summary>
    ///读取保存寄存器03  
    /// </summary>
    [Command(Key = (byte)0x03)]
    // [HoldingRegistersCommandFilterAttribute]
    public   class ReadHoldingRegistersAsyncCommand  : IAsyncCommand<ModbusPackageInfo>  
    
    {

        public ReadHoldingRegistersAsyncCommand()
        {
             
        }
         

        public async ValueTask ExecuteAsync(IAppSession session, ModbusPackageInfo package)
        {
            
            Console.WriteLine($"send... {package.Body.Length}");
            
            await  session.SendAsync(package.Body);
        }
    }
}